<!DOCTYPE html>
<html>
<head>
<title>服装ERP管理系统</title>

<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">

<script type="text/javascript" charset="UTF-8" src="jslib/My97DatePicker4.8Beta2/My97DatePicker/WdatePicker.js"></script>

<script type="text/javascript" charset="UTF-8" src="jslib/jquery-easyui-1.2.5/jquery-1.7.1.min.js"></script>

<script type="text/javascript" charset="UTF-8" src="jslib/jquery.cookie.js"></script>

<link id="easyuiTheme" rel="stylesheet" type="text/css" href="jslib/jquery-easyui-1.2.5/themes/gray/easyui.css">
<script type="text/javascript" charset="UTF-8" src="jslib/changeEasyuiTheme.js"></script>
<link rel="stylesheet" type="text/css" href="jslib/jquery-easyui-1.2.5/themes/icon.css">
<script type="text/javascript" charset="UTF-8" src="jslib/jquery-easyui-1.2.5/jquery.easyui.min.js"></script>
<script type="text/javascript" charset="UTF-8" src="jslib/jquery-easyui-1.2.5/locale/easyui-lang-zh_CN.js"></script>

<link rel="stylesheet" type="text/css" href="jslib/jquery-easyui-portal/portal.css">
<script type="text/javascript" charset="UTF-8" src="jslib/jquery-easyui-portal/jquery.portal.js"></script>

<link rel="stylesheet" type="text/css" href="jslib/JQuery-zTree-v3.1/css/zTreeStyle/zTreeStyle.css">
<script type="text/javascript" charset="UTF-8" src="jslib/JQuery-zTree-v3.1/js/jquery.ztree.all-3.1.min.js"></script>

<link rel="stylesheet" type="text/css" href="jslib/erpCss.css">
<script type="text/javascript" charset="UTF-8" src="jslib/erpUtil.js"></script>

<script type="text/javascript" charset="UTF-8">
	$(function() {

		erp.$loginInputForm = $('#loginInputForm').form();

		erp.$loginDialog = $('#loginDialog').show().dialog({
			closable : false,
			width : 250,
			height : 170,
			modal : true,
			title : '系统登录',
			buttons : [{
				text : '登录',
				iconCls : '',
				handler : function() {
					erp.loginFun();
				}
			} ],
			onOpen : function() {
				window.setTimeout(function() {
					erp.$loginDialog.find('input[name=password]').val('');
					erp.$loginInputForm.find('input[name=name]').focus();
				}, 500);
			}
		});

		erp.$loginTabs = $('#loginTabs').tabs({
			border : false
		});

		erp.loginFun = function() {
			var selectedTab = erp.$loginTabs.tabs('getSelected');
			var f = selectedTab.find('form');
			var data = {};
			if (f.attr('id') == 'loginInputForm') {
				data = f.serialize();
			} else if (f.attr('id') == 'loginDatagridForm') {
				data = {
					name : erp.$loginDatagridName.combogrid('getValue'),
					password : f.find('input[name=password]').val()
				};
			} else if (f.attr('id') == 'loginComboboxForm') {
				data = {
					name : erp.$loginComboboxName.combobox('getValue'),
					password : f.find('input[name=password]').val()
				};
			}
			if (f.form('validate')) {
				$.ajax({
					url : 'userController.do?login',
					data : data,
					dataType : 'json',
					success : function(r) {
						if (r.success) {
							$.messager.show({
								title : '提示',
								msg : r.msg
							});
							erp.$loginDialog.dialog('close');
							$('#indexLayout').layout('panel', 'center').panel('setTitle', erp.fs('[{0}]，欢迎您！[{1}]', r.obj.name, r.obj.ip));
						} else {
							$.messager.alert('提示', r.msg, 'error');
						}
					}
				});
			}
		};

		erp.$loginDialog.find('[name=name],[name=password]').bind('keyup', function(event) {/* 增加回车提交功能 */
			if (event.keyCode == '13') {
				erp.loginFun();
			}
		});

	});
</script>

</head>

<body id="indexLayout" class="easyui-layout">

	<div href="layout/north.html" region="north" style="height:50px;overflow: hidden;"></div>
	<div href="layout/south.html" region="south" style="height:20px;overflow: hidden;"></div>
	<div href="layout/west.html" region="west" split="true" title="导航" style="width:200px;overflow: hidden;"></div>
	<div href="layout/center.html" region="center" title="欢迎使用ERP服装管理系统" style="overflow: hidden;"></div>

	<div id="loginDialog" style="overflow: hidden;display: none;" closed="true" >
		<div id="loginTabs" style="overflow: hidden;">
			<div title="输入方式" style="overflow: hidden;">
				<form id="loginInputForm">
					<table class="tableForm">
						<tr>
							<th style="width: 50px;">登录名</th>
							<td><input name="name" class="easyui-validatebox" required="true" /></td>
						</tr>
						<tr>
							<th>密码</th>
							<td><input name="password" type="password" class="easyui-validatebox" required="true" /></td>
						</tr>
					</table>
				</form>
			</div>
			<div title="表格方式" style="overflow: hidden;" href="user/loginDatagridForm.html"></div>
			<div title="补全方式" style="overflow: hidden;" href="user/loginComboboxForm.html"></div>
		</div>
	</div>

	<div id="regDialog" style="overflow: hidden;display: none;">
		<form id="regForm">
			<table class="tableForm">
				<tr>
					<th style="width: 50px;">用户名</th>
					<td><input name="name" class="easyui-validatebox" required="true" /></td>
				</tr>
				<tr>
					<th>密码</th>
					<td><input name="password" type="password" class="easyui-validatebox" required="true" /></td>
				</tr>
				<tr>
					<th>重复</th>
					<td><input name="rePassword" type="password" class="easyui-validatebox" required="true" validType="eqPassword['#regForm [name=password]']" /></td>
				</tr>
			</table>
		</form>
	</div>

</body>
</html>
